<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增案件信息')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-info-add" th:object="${vo}">
            <input id="caseId" name="caseId" type="hidden" th:field="*{caseId}"/>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">案由名称：</label>
                <div class="col-sm-8">
                    <input name="caseName" class="form-control" type="text" th:field="*{caseName}" required>
                </div>
            </div>
 
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">一、委托方: </label>
                <div class="col-sm-8">
	                <div class="input-group">
	                	<button type="button" class="btn btn-white btn-sm" onclick="addRow_principal()"><i class="fa fa-plus"> 增加</i></button>
	                    <!-- <button type="button" class="btn btn-white btn-sm" onclick="deleteRow_principal_after4()"><i class="fa fa-sort"> 排序</i></button> -->
	                	<!-- <button type="button" class="btn btn-white btn-sm" onclick="addRow_principal_empty()"><i class="fa fa-plus"> 增加全新 </i></button> -->
	                </div>
                </div>
                <div name="div_principal_body" id="div_principal_body">
                	<input id="principal_cur_idx" type="hidden" value=""/>
	            	<div th:each="bean,stat:${vo.principal}" name="div_principal" th:id="|div_principal_${stat.index}|">
		                <label class="col-sm-3 control-label is-required" name="div_principal_index">委托方: [[${stat.index+1}]]</label>
		                <div class="col-sm-8" name='div_principal_col_sm'>
		                  <div class="input-group" name='div_principal_input'>
	                  			<!-- hidden begin -->
	          					<input type="hidden" name="caseCustIndex" th:field="*{principal[__${stat.index}__].caseCustIndex}" th:id="|principal_${stat.index}_caseCustIndex|"/>
	          					<input type="hidden" name="caseCustType" th:field="*{principal[__${stat.index}__].caseCustType}" th:id="|principal_${stat.index}_caseCustType|"/>
	          					<input type="hidden" name="custId" th:field="*{principal[__${stat.index}__].custId}" th:id="|principal_${stat.index}_custId|"/>
	          					<input type="hidden" name="custName" th:field="*{principal[__${stat.index}__].custName}" th:id="|principal_${stat.index}_custName|"/>
	          					<input type="hidden" name="certNo" th:field="*{principal[__${stat.index}__].certNo}" th:id="|principal_${stat.index}_certNo|"/>
	          					<input type="hidden" name="custType" th:field="*{principal[__${stat.index}__].custType}" th:id="|principal_${stat.index}_custType|"/>
								<!-- hidden end -->
								<input name="custSelect" th:id="|custSelect_principal_${stat.index}|" type="text" placeholder="请选择客户" class="form-control" 
		                    	    readonly th:value="|${bean.custName}-${bean.certNo}|">
		                    	<span name="selectUserInfo" class="input-group-addon" th:onclick="selectUserInfo_principal([[${stat.index}]])"><i class="fa fa-search"></i></span>
		                    	<span name="deleteRow" class="input-group-addon" th:onclick="deleteRow_principal([[${stat.index}]])"><i class="fa fa-minus"></i></span>
		                  </div>
		                </div>
	                </div>
	           </div>
            </div>

            <div class="form-group">
                <label class="col-sm-3 control-label">二、利益相对方: </label>
                <div class="col-sm-8">
	                <div class="input-group">
	                	<button type="button" class="btn btn-white btn-sm" onclick="addRow_oppositor()"><i class="fa fa-plus"> 增加</i></button>
	                    <!-- <button type="button" class="btn btn-white btn-sm" onclick="deleteRow_oppositor_after4()"><i class="fa fa-sort"> 排序</i></button> -->
	                	<!-- <button type="button" class="btn btn-white btn-sm" onclick="addRow_oppositor_empty()"><i class="fa fa-plus"> 增加全新 </i></button> -->
	                </div>
                </div>
                <div name="div_oppositor_body" id="div_oppositor_body">
                	<input id="oppositor_cur_idx" type="hidden" value=""/>
	            	<div th:each="bean,stat:${vo.oppositor}" name="div_oppositor" th:id="|div_oppositor_${stat.index}|">
		                <label class="col-sm-3 control-label is-required" name="div_oppositor_index">利益相对方: [[${stat.index+1}]]</label>
		                <div class="col-sm-8" name='div_oppositor_col_sm'>
		                  <div class="input-group" name='div_oppositor_input'>
	                  			<!-- hidden begin -->
	          					<input type="hidden" name="caseCustIndex" th:field="*{oppositor[__${stat.index}__].caseCustIndex}" th:id="|oppositor_${stat.index}_caseCustIndex|"/>
	          					<input type="hidden" name="caseCustType" th:field="*{oppositor[__${stat.index}__].caseCustType}" th:id="|oppositor_${stat.index}_caseCustType|"/>
	          					<input type="hidden" name="custId" th:field="*{oppositor[__${stat.index}__].custId}" th:id="|oppositor_${stat.index}_custId|"/>
	          					<input type="hidden" name="custName" th:field="*{oppositor[__${stat.index}__].custName}" th:id="|oppositor_${stat.index}_custName|"/>
	          					<input type="hidden" name="certNo" th:field="*{oppositor[__${stat.index}__].certNo}" th:id="|oppositor_${stat.index}_certNo|"/>
	          					<input type="hidden" name="custType" th:field="*{oppositor[__${stat.index}__].custType}" th:id="|oppositor_${stat.index}_custType|"/>
								<!-- hidden end -->
								<input name="custSelect" th:id="|custSelect_oppositor_${stat.index}|" type="text" placeholder="请选择客户" class="form-control" 
		                    	    readonly th:value="|${bean.custName}-${bean.certNo}|">
		                    	<span name="selectUserInfo" class="input-group-addon" th:onclick="selectUserInfo_oppositor([[${stat.index}]])"><i class="fa fa-search"></i></span>
		                    	<span name="deleteRow" class="input-group-addon" th:onclick="deleteRow_oppositor([[${stat.index}]])"><i class="fa fa-minus"></i></span>
		                  </div>
		                </div>
	                </div>
	           </div>
            </div>

            <div class="form-group">
                <label class="col-sm-3 control-label">三、第三方: </label>
                <div class="col-sm-8">
	                <div class="input-group">
	                	<button type="button" class="btn btn-white btn-sm" onclick="addRow_thirdParty()"><i class="fa fa-plus"> 增加</i></button>
	                    <!-- <button type="button" class="btn btn-white btn-sm" onclick="deleteRow_thirdParty_after4()"><i class="fa fa-sort"> 排序</i></button> -->
	                	<!-- <button type="button" class="btn btn-white btn-sm" onclick="addRow_thirdParty_empty()"><i class="fa fa-plus"> 增加全新 </i></button> -->
	                </div>
                </div>
                <div name="div_thirdParty_body" id="div_thirdParty_body">
                	<input id="thirdParty_cur_idx" type="hidden" value=""/>
	            	<div th:each="bean,stat:${vo.thirdParty}" name="div_thirdParty" th:id="|div_thirdParty_${stat.index}|">
		                <label class="col-sm-3 control-label is-required" name="div_thirdParty_index">第三方: [[${stat.index+1}]]</label>
		                <div class="col-sm-8" name='div_thirdParty_col_sm'>
		                  <div class="input-group" name='div_thirdParty_input'>
	                  			<!-- hidden begin -->
	          					<input type="hidden" name="caseCustIndex" th:field="*{thirdParty[__${stat.index}__].caseCustIndex}" th:id="|thirdParty_${stat.index}_caseCustIndex|"/>
	          					<input type="hidden" name="caseCustType" th:field="*{thirdParty[__${stat.index}__].caseCustType}" th:id="|thirdParty_${stat.index}_caseCustType|"/>
	          					<input type="hidden" name="custId" th:field="*{thirdParty[__${stat.index}__].custId}" th:id="|thirdParty_${stat.index}_custId|"/>
	          					<input type="hidden" name="custName" th:field="*{thirdParty[__${stat.index}__].custName}" th:id="|thirdParty_${stat.index}_custName|"/>
	          					<input type="hidden" name="certNo" th:field="*{thirdParty[__${stat.index}__].certNo}" th:id="|thirdParty_${stat.index}_certNo|"/>
	          					<input type="hidden" name="custType" th:field="*{thirdParty[__${stat.index}__].custType}" th:id="|thirdParty_${stat.index}_custType|"/>
								<!-- hidden end -->
								<input name="custSelect" th:id="|custSelect_thirdParty_${stat.index}|" type="text" placeholder="请选择客户" class="form-control" 
		                    	    readonly th:value="|${bean.custName}-${bean.certNo}|">
		                    	<span name="selectUserInfo" class="input-group-addon" th:onclick="selectUserInfo_thirdParty([[${stat.index}]])"><i class="fa fa-search"></i></span>
		                    	<span name="deleteRow" class="input-group-addon" th:onclick="deleteRow_thirdParty([[${stat.index}]])"><i class="fa fa-minus"></i></span>
		                  </div>
		                </div>
	                </div>
	           </div>
            </div>
            
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">案件类型：</label>
                    <div id="element_ct" class="row">
                        <div class="col-sm-2">
                            <select class="type form-control m-b" th:field="*{caseTypeId}" data-first-title="请选择">
			                  <option value="">请选择</option>
			                  <option th:value="*{caseTypeId}" th:selected="1"></option>
			                </select>
		                </div>
                        <div class="col-sm-2">
						&nbsp;&nbsp;&nbsp;&nbsp;诉讼类型：
		                </div>
		                <div class="col-sm-2">
			                <select class="router form-control m-b" th:field="*{litigateTypeId}" data-first-title="请选择">
			                  <option value="">请选择</option>
			                  <option th:value="*{litigateTypeId}" th:selected="1"></option>
			                </select>
		                </div>
                	</div>
            </div>
            
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">案件阶段：</label>
                <div id="element_casePhases" class="row">
                 	<div class="col-sm-2">
		             	<select name="select_case_phase" class="form-control m-b" th:field="*{casePhaseId}">
		                    <option value="">请选择</option>
			      			<option th:each="u : ${casePhases}" th:text="${u.casePhaseName}" th:value="${u.casePhaseId}" th:field="*{casePhaseId}"></option>
			   			</select>
                	</div>
              	</div>
            </div>

            <div class="form-group">    
                <label class="col-sm-3 control-label">备注：</label>
                <div class="col-sm-8">
                    <input name="remark" class="form-control" type="text" th:field="*{remark}">
                </div>
            </div>
        </form>
    </div>
    <div class="row">
        <div class="col-sm-offset-5 col-sm-10">
            <button type="button" class="btn btn-sm btn-primary" onclick="submitHandler()"><i class="fa fa-check"></i>保 存</button>&nbsp;
            <button type="button" class="btn btn-sm btn-danger" onclick="closeItem()"><i class="fa fa-reply-all"></i>关 闭 </button>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: jquery-cxselect-js" />
	<script th:inline="javascript" src="/js/biz/caseinfo/add_principal.js"></script>
	<script th:inline="javascript" src="/js/biz/caseinfo/add_oppositor.js"></script>
	<script th:inline="javascript" src="/js/biz/caseinfo/add_thirdparty.js"></script>
           
    <script th:inline="javascript">
        var prefix = ctx + "biz/caseinfo"
        $("#form-info-add").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                var data = $("#form-info-add").serializeArray();
                $.operate.saveTab(prefix + "/add", data);
            }
        }
   </script>
   
	<script th:inline="javascript">
		// 直接返回获取
		var ctData = [[${ctData}]];
		$('#element_ct').cxSelect({
		  selects: ['type', 'router'],
		  jsonValue: 'v',
		  data: ctData
		});
	</script>
    
</body>
</html>